<!-- Следует наследовать виджеты главной страницы от этого шаблона -->

<div class="widget title-widget wg-{{@:widget_div_name}} wg-sortable" id="{{widget.widget_id}}"><div class="bg-l-"><div class="bg-r-"><div class="bg-t-"><div class="bg-tl-"></div><div class="bg-tr-"></div></div>
	{{?widget.moderator_mode}}{{@:actionspanel}}{{/?}}
	{{@:js_config}}
	<h2 class="title-">{{@:widget_title}}</h2>
	<div class="content-">{{@:widget_body}}</div>
<div class="bg-b-"><div class="bg-bl-"></div><div class="bg-br-"></div></div></div></div></div>


{{:widget_title}}{{widget.title}}{{/:widget_title}}

{{:widget_div_name}}{{/:widget_div_name}}

{{:widget_body}}{{/:widget_body}}

{{:js_config}}
	{{?widget.ui_frontjs}}
		<a href="{{!static type='js' widget.ui_frontjs}}" id="frontjs{{widget.widget_id}}" class="dn"></a>
	{{/?}}
	{{?widget.ui_configurable}}
		<a href="{{!static type='js' widget.ui_settingsjs}}" id="setjs{{widget.widget_id}}" class="dn"></a>
	{{/?}}
{{/:js_config}}

{{:actionspanel}}
<ul class="actionspanel-">
	{{?widget.ui_configurable}}
	<li class="edit-"><a href="#">Редактировать</a></li>
	{{/?}}
	<li class="delete-"><a href="#">Удалить</a></li>
</ul>
{{/:actionspanel}}

<!-- кнопки в попапе настроек-->
{{:settingsbutton}}
<div class="buttons-">
	<input type="image" src="{{images}}button-save-gray.gif" alt="Сохранить" id="submit_button" class="button- submit-" />
	<a href="#" class="bn" id="close_button"><img src="{{images}}button-cancel-gray.gif" alt"Закрыть" class="cancel- button-" /></a>
</div>
{{/:settingsbutton}}


<!-- Дефолтный попап настроек виджета -->
{{:settings}}
<div class="popup-widgets" id="settings_container">
	<form action="" id="settingsform">
	<input type="hidden" name="widget_id" value="{{settings.id}}" id="widget_id" />
	<h2 class="title-">{{settings.form.title}}</h2>
	<div class="content-">
		{{!for settings.form.fields as='field' do=@:formfield}}
	</div>
	{{@:settingsbutton}}
	</form>
</div>
{{/:settings}}


<!-- Эти шаблоны используются для генерации форм в настройках виджета -->

<!-- text -->

{{:formfield field.type == 'text'}}
	<div class="fieldset- header- text-">
		<label for="fpl_{{field.name}}">{{field.title}}</label>
		<input id="fpl_{{field.name}}" type="text" name="{{field.name}}" value="{{field.value|escape}}" />
		<div class="comment-">{{field.description}}</div>
	</div>
{{/:formfield}}

<!-- checklist -->

{{:formfield field.type == 'checklist'}}
	<fieldset class="fieldset- checkboxes- js_sectionslist">
		<legend>{{field.title}}</legend>
			<ul class="list-">
				<label for="fpl_directory00"><span class="root-"><input class="js_all_cb" type="checkbox" id="fpl_directory00" name="tdis[]"/>Все</span></label>
				{{!for field.fields as='item' do=@:item_checkbox}}
					{{:item_checkbox}}
					<li>
					<input class="js_cb" id="fpl_{{field.name}}{{For.key}}" type="checkbox" {{?item.checked}}checked="checked"{{/?}} name="{{field.name}}[]" value="{{item.value|escape}}" />
					<label for="fpl_{{field.name}}{{For.key}}">{{item.title}}</label>
					</li>
					{{/:item_checkbox}}

			</ul>
		<div class="comment-">{{field.description}}</div>
	</fieldset>
{{/:formfield}}

<!-- select / option -->

{{:formfield field.type == 'select'}}
	<div class="fieldset- count- select-">
		<label for="fpl_{{field.name}}">{{field.title}}</label>
		<select id="fpl_{{field.name}}" name="{{field.name}}">
			{{!for field.fields as='option' do=@:option}}
			{{:option}}
			<option value="{{option.value}}" {{?option.selected}}selected="selected"{{/?}}>{{option.title}}</option>
			{{/:option}}
		</select>
		<div class="comment-">{{field.description}}</div>
	</div>
{{/:formfield}}

<!-- radio / option -->

{{:formfield field.type == 'radio'}}
<fieldset class="fieldset- header- text-">
	<label>{{field.title}}</label>

	{{!for field.fields as='option' do=@:radio}}
	{{:radio option.type == 'option'}}
	<input type="radio" style="display:inline;width: 24px;" id="{{field.name}}_{{option.value}}" name="{{field.name}}" value="{{option.value}}"{{?option.selected}} checked="checked"{{/?}} />
	<label for="{{field.name}}_{{option.value}}" style="display:inline; margin-left: 24px;"> {{option.title}}</label><br />
	{{/:radio}}
	{{:radio}}{{@:formfield field=option}}{{/:radio}}

	{{!for settings.community do=@:community}}
</fieldset>
{{/:formfield}}

<!-- textarea -->

{{:formfield field.type == 'textarea'}}
	<div class="fieldset- desc- textarea-">
		<label for="fpl_{{field.name}}">{{field.title}}</label>
		<textarea id="fpl_{{field.name}}" name="{{field.name}}">{{field.value|escape}}</textarea>
		<div class="comment-">{{field.description}}</div>
	</div>
{{/:formfield}}

<!-- wisiwig -->

{{:formfield field.type == 'wysiwig'}}
	<div class="fieldset- desc- textarea-">
		<label for="fpl_{{field.name}}">{{field.title}}</label>
		<textarea id="fpl_{{field.name}}" name="{{field.name}}" cols="60" rows="10" class="mceEditor light">{{field.value|escape}}</textarea>
		<div class="comment-">{{field.description}}</div>
		<script type="text/javascript">
			setTimeout("tinyMCE.execCommand('mceAddControl', false, 'fpl_{{field.name}}')",1);
		</script>
	</div>
{{/:formfield}}

{{:community}}
	<input type="checkbox" style="display:inline;width: 24px;" onclick="toggleGroup(this, 'community{{*oid}}childs-');" class="commcheck-" id="community{{*oid}}"{{?*checked}} checked="checked"{{/?}} name="community_list[]" value="{{*oid}}">
	<label for="community{{*oid}}" style="display:inline; margin-left: 24px;">{{*title}}</label><br />
	{{?*tdi}}
	<div style="padding-left: 24px;">
	{{!for *tdi do=@:tdi}}{{:tdi}}
		<input type="checkbox" style="display:inline;width: 24px;" onclick="testCheckParent(this, '{{*community_oid}}', 'community{{*community_oid}}childs-');" class="commcheck- community{{*community_oid}}childs-" id="tdi{{*oid}}"{{?*checked}} checked="checked"{{/?}} name="tdi_list[]" value="{{*oid}}" />
		<label for="tdi{{*oid}}" style="display:inline; margin-left: 24px;">{{*title}}</label><br />
	{{/:tdi}}
	</div>
	{{/?}}
{{/:community}}